﻿using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace GoFishWeb.Models
{
    public class PlayerRecord
    {
        protected PlayerRecord()
        {
            Games = new Collection<GoFishGame>();
            // needed for entity framework.  Must be no parameters and can not be private
        }

        public PlayerRecord(string userName)
        {
            Games = new Collection<GoFishGame>();
            UserName = userName;
        }

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }

        [Required]
        public string UserName { get; set; }

        [Required]
        public int Wins { get; set; }

        [Required]
        public int Losses { get; set; }

        [Required]
        public int Ties { get; set; }

        public virtual ICollection<GoFishGame> Games { get; set; }
    }
}